<?php

namespace agent\behavior;

class UserBehavior extends AgentBehavior
{
    public function addUserOperators(&$item)
    {
        $url = url('/store/user/setting/userId/' . $item['user_id']);
        $url2 = url('/store/user/subs/userId/').$item['user_id'];
        $link = '<a href="'.$url.'" class="am-btn-sm am-btn am-btn-default am-btn-success am-radius">设置</a>';
        $link2 = $item['agent_level']<4?'<a href="'.$url2.'" class="am-btn-sm am-btn am-btn-default am-btn-primary am-radius">下线</a> ':'';
//        if($item['agent_level']<4){
//            $sturl = url('/store/user/statistics/userId/').$item['user_id'];
//            $op = '<a href="'.$sturl.'" class="am-btn-sm am-btn am-btn-default am-btn-primary am-radius">业绩统计</a>';
//        }else{
//            $op = '';
//        }

        $operators = <<<EOT
$link
$link2 
EOT;
        return $operators;
    }

    public function addUserIndexJavascript()
    {
        $js = <<<EOT
function userSetting(userId) {
    layer.open({
        type: 1,
        skin: 'layui-layer-rim', //加上边框
        area: ['420px', '240px'], //宽高
        content: "<?=url('/store/user/setting?userId')?>" + userId
    });
}
EOT;
        return $js;
    }
}